//
//  DoctorViewController.m
//  QuickCure
//
//  Created by 曹魏 on 16/9/15.
//  Copyright © 2016年 haoge. All rights reserved.
//
/**
 *  7.获取医生列表接口
 user_id 表示用户编号
 
 请求地址: http://iosapi.itcast.cn/matchDoctors.json.php
 请求参数:
 {"ci1_id":1,"ci2_id":3,"ci3_id":3,"diagnosis_type":0,"page_size":15,"is_confirmed":1,"user_id":1000089, "page":1,"has_diagnosis":2}
 
 */

#import "AttentionDoctorModel.h"
#import "NetWorkTool.h"

@implementation AttentionDoctorModel

+ (instancetype)AttentionDoctorModelWithDictionary:(NSDictionary *)dict
{
    AttentionDoctorModel *model = [[self alloc]init];
    [model setValuesForKeysWithDictionary:dict];
    return model;
}
- (void)setValue:(id)value forUndefinedKey:(NSString *)key{};

+ (void)doctorListWithSuccess:(void(^)(NSArray *))successBlock
{
    NSDictionary *dict = @{@"ci1_id":@1,
                           @"ci2_id":@3,
                           @"ci3_id":@3,
                           @"diagnosis_type":@0,
                           @"page_size":@15,
                           @"is_confirmed":@1,
                           @"user_id":@1000089,
                           @"page":@1,
                           @"has_diagnosis":@2
                           };
    
    [[NetWorkTool shareManager]POST_RequestWithUrlString:@"http://iosapi.itcast.cn/matchDoctors.json.php" parmas:dict successBloock:^(NSDictionary * responseObject) {
        
        NSLog(@"%@",responseObject);

        NSArray *array = responseObject[@"data"];
        NSMutableArray *mArray = [NSMutableArray array];
        [array enumerateObjectsUsingBlock:^(NSDictionary *  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            AttentionDoctorModel *model = [AttentionDoctorModel AttentionDoctorModelWithDictionary:obj];
            [mArray addObject:model];
        }];
        
        if(successBlock)
        {
            successBlock(mArray.copy);
        }
        
    } failureBlock:^(NSError *error) {
        
        NSLog(@"获取数据失败");

    }];
}

- (NSString *)description
{
    return [NSString stringWithFormat:@"%@oprationCount = %@,flower = %@,banner = %@",[super description],_operation_count,_flower,_banner];
}
@end










